package com.ruoyi.agriculture.guo.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.agriculture.guo.mapper.AgriConversationRecordMapper;
import com.ruoyi.agriculture.guo.domain.AgriConversationRecord;
import com.ruoyi.agriculture.guo.service.IAgriConversationRecordService;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Date;
/**
 * 农业问答会话记录Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-07-31
 */
@Service
public class AgriConversationRecordServiceImpl implements IAgriConversationRecordService 
{
    @Autowired
    private AgriConversationRecordMapper agriConversationRecordMapper;

    /**
     * 查询农业问答会话记录
     * 
     * @param id 农业问答会话记录主键
     * @return 农业问答会话记录
     */
    @Override
    public AgriConversationRecord selectAgriConversationRecordById(Long id)
    {
        return agriConversationRecordMapper.selectAgriConversationRecordById(id);
    }

    /**
     * 查询农业问答会话记录列表
     * 
     * @param agriConversationRecord 农业问答会话记录
     * @return 农业问答会话记录
     */
    @Override
    public List<AgriConversationRecord> selectAgriConversationRecordList(AgriConversationRecord agriConversationRecord)
    {
        return agriConversationRecordMapper.selectAgriConversationRecordList(agriConversationRecord);
    }

    /**
     * 新增农业问答会话记录
     * 
     * @param agriConversationRecord 农业问答会话记录
     * @return 结果
     */
    @Override
    public int insertAgriConversationRecord(AgriConversationRecord agriConversationRecord)
    {
        if (agriConversationRecord.getSendTime() == null) {
            agriConversationRecord.setSendTime(Date.from(LocalDateTime.now().atZone(ZoneId.systemDefault()).toInstant()));
        }
        return agriConversationRecordMapper.insertAgriConversationRecord(agriConversationRecord);
    }

    /**
     * 修改农业问答会话记录
     * 
     * @param agriConversationRecord 农业问答会话记录
     * @return 结果
     */
    @Override
    public int updateAgriConversationRecord(AgriConversationRecord agriConversationRecord)
    {
        return agriConversationRecordMapper.updateAgriConversationRecord(agriConversationRecord);
    }

    /**
     * 批量删除农业问答会话记录
     * 
     * @param ids 需要删除的农业问答会话记录主键
     * @return 结果
     */
    @Override
    public int deleteAgriConversationRecordByIds(Long[] ids)
    {
        return agriConversationRecordMapper.deleteAgriConversationRecordByIds(ids);
    }

    /**
     * 删除农业问答会话记录信息
     * 
     * @param id 农业问答会话记录主键
     * @return 结果
     */
    @Override
    public int deleteAgriConversationRecordById(Long id)
    {
        return agriConversationRecordMapper.deleteAgriConversationRecordById(id);
    }
}
